/**
 * 
 */
package com.boot.springBoot.entity.annotations;

import java.lang.reflect.Field;

/**
 * @author Administrator
 *
 */
public class Testreflectively {
	
	/** 
	 * 
	    * @Title: init  
	    * @Description: TODO(这里用一句话描述这个方法的作用)  
	    * @param @param obj
	    * @param @throws IllegalArgumentException
	    * @param @throws IllegalAccessException    参数  
	    * @return void    返回类型  
	    * @throws
	 */
	public static <T>  void init(TestAnnotations obj) throws IllegalArgumentException, IllegalAccessException {
		
		Field[] fields = obj.getClass().getDeclaredFields();
		for (Field f : fields) {
			if(f.isAnnotationPresent(MyAnnotations.class)){
				MyAnnotations objs = f.getAnnotation(MyAnnotations.class);
				String age = objs.age();
				String name = objs.name();
				f.set(obj, age);
				f.set(obj, name);
			}
		}
		
	}
}
